import Vue from 'vue'
import VueRouter, { RouteConfig } from 'vue-router'

Vue.use(VueRouter)

const routes: Array<RouteConfig> = [
  {
    path: "/",
    redirect: "/home/goods" // 重定向到商品列表
  },
  {
    path: "/home",
    component: () => import("../views/home/Home.vue"),
    children: [
      {
        path: "goods",
        component: () => import('../views/home/module/GoodsList.vue')
      },
      {
        path: "evaluate",
        component: () => import('../views/home/module/Evaluate.vue')
      },
      {
        path: "enterprise",
        component: () => import('../views/home/module/Enterprise.vue')
      },
    ]
  },
  {
    path: '/goods-detail',
    component: () => import('../views/detail/GoodsDetail.vue')
  },
  {
    path: "*",
    component: () => import("../views/err404/Error404.vue")
  }
]

const router = new VueRouter({
  routes
})

export default router
